<extend name="Base:base" />
<block name="base_main">
	<link rel="stylesheet" href="__PUBLIC__/seller/css/validform.css" />
	<script src="__PUBLIC__/seller/js/Validform_v5.3.2.js"></script>
	<style>
		body{ background:#fff }
	</style>
	<div class="tpl-block ">
		<div class="am-g tpl-amazeui-form">
			<div class="am-u-sm-12 am-u-md-9">
							<style>
                                .pay_ment_info{ width:80%;  }
                                .pay_ment_info dl dt{ width:100%; height:40px; line-height:40px; font-size:16px; border-bottom:1px solid #ccc; text-indent:10px;}
                                .pay_ment_info dl dd{ float:left; line-height:220%; width:100%; text-indent:20px; color:#666 }
                                .pay_ment_info dl dd span{ color:#333; }
                            </style>
                  
                            <div class="pay_ment_info">
                                <dl>
                                    <dd><span>支付方式：</span>
                                        <?php if($payInfo['weixin_pay_id']>0):?>
                                        <label><input name="pay" id="pay" type="radio" value="{$payInfo['weixin_pay_id']}"  />微信 </label> 
                                        <?php endif;?>
                                        <?php if($payInfo['alipay_pay_id']>0):?>
                                        <label><input name="pay" id="pay" type="radio" value="{$payInfo['alipay_pay_id']}"  />支付宝 </label> 
                                        <?php endif;?>
										<label><input name="pay" id="pay" type="radio" value="preset"  />预付款 </label> 
                                    </dd>
									<dd style="display:none" id="money"><span>账户余额：</span>{:sprintf("%.2f",$local_price)}</dd>
                                    <dd><span>支付金额：</span>{:sprintf("%.2f",$val['pay_total'])}</dd>
                                </dl>
                            </div>
                            <div class="am-u-sm-5 am-u-sm-push-4">
                                <button type="button" id="submit_pay" class="am-btn am-btn-primary" >去支付</button>
                            </div>
			</div>
		</div>
	</div>
        <script>
                $('#submit_pay').click(function(){
                    var id = "<?php echo $val['id'];?>";
                    if($('input#pay:checked').length >0){
						if( $('input#pay:checked').val() == 'preset' ) {
							<?php if( $local_price == '0.00' ) : ?>
							alert('账户金额不足,请充值之后再支付');
							return false;
							<?php else : ?>
							if( parseFloat({$local_price}) < parseFloat({$val['pay_total']}) ) {
								alert('账户金额不足,请充值之后再支付');
								return false;
							}
							<?php endif;?>
						}
						window.open(getUrl('Pay/pay' , { 'id':id , 'type' : 'buy' , 'pay_id' : $('input#pay:checked').val() }));
						parent.window.pay_notify();
                    }else{
                        alert('请选择支付方式');
                    }
                });
				$('input#pay').click(function(){
					if( $(this).val() == 'preset' ) {
						$('#money').show();
					} else {
						$('#money').hide();
					}
				});
        </script>
</block>